<template>
  <div>
    <!--  ref="form" :model="form" -->
    <el-form :model="skuForm" label-width="100px">
      <el-form-item label="SPU名称">{{}}
      </el-form-item>
      <el-form-item label="SKU名称">
        <el-input placeholder="SKU名称"></el-input>
      </el-form-item>
      <el-form-item label="价格(元)">
        <el-input placeholder="价格(元)"></el-input>
      </el-form-item>
      <el-form-item label="重量(千克)">
        <el-input placeholder="重量(千克)"></el-input>
      </el-form-item>
      <el-form-item label="规格描述">
        <el-input type="textarea" placeholder="规格描述" rows="4"></el-input>
      </el-form-item>
      <el-form-item label="平台属性" :inline="true">
        <!--      ref="form" :model="form"-->
        <el-form :inline="true" label-width="100px">
          <el-form-item label="小米">
            <el-select value=" " placeholder="请选择">
              <el-option label="区域一" value=""></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="分公司">
            <el-select value=" " placeholder="请选择">
              <el-option label="区域一" value=""></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="且为">
            <el-select value=" " placeholder="请选择">
              <el-option label="区域一" value=""></el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </el-form-item>
      <el-form-item label="销售属性" :inline="true">
        <!--      ref="form" :model="form"-->
        <el-form :inline="true" label-width="100px">
          <el-form-item label="颜色">
            <el-select value=" " placeholder="请选择">
              <el-option label="区域一" value=""></el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </el-form-item>
      <el-form-item label="图片列表">
        <!--     tooltip-effect="dark" :data="tableData" @selection-change="handleSelectionChange"-->
        <el-table
          border
          ref="multipleTable"
          style="width: 100%;margin-bottom: 20px"
        >
          <el-table-column
            type="selection"
            width="55">
          </el-table-column>
          <el-table-column
            label="图片"
            width="120">
            <template slot-scope="scope"></template>
          </el-table-column>
          <el-table-column
            prop="prop"
            label="名称"
            width="120">
          </el-table-column>
          <el-table-column
            prop="prop"
            label="操作"
            show-overflow-tooltip>
          </el-table-column>
        </el-table>
        <el-button type="primary">保存</el-button>
        <el-button>取消</el-button>
      </el-form-item>

    </el-form>
  </div>
</template>

<script>
export default {
  name: "SkuForm",
  data() {
    return {
      category1Id: '',
      category2Id: '',
      category3Id: '',
      type: [],
      attrInfoList: [],
      spuSaleAttrList: [],
      spuImageList: [],
      skuForm:{}//收集数据用的这个
    }
  },
  methods: {
    //初始化sku数据
    async getInitSkuFormData(row, category1Id, category2Id, category3Id) {
      //http://localhost:9529/dev-api/admin/product/attrInfoList/1/1/1
      this.category1Id = category1Id
      this.category2Id = category2Id
      this.category3Id = category3Id
      const result1 = await this.$API.attr.getAttrInfoList(category1Id, category2Id, category3Id)
      if (result1.code === 200 || result1.code === 20000) {
        this.attrInfoList = result1.data
      }
      //http://localhost:9529/dev-api/admin/product/spuSaleAttrList/1990
      const result2 = await this.$API.sku.getSpuSaleAttrList(row.id)
      if (result2.code === 200 || result2.code === 20000) {
        this.spuSaleAttrList = result2.data
      }
      //http://localhost:9529/dev-api/admin/product/spuImageList/1990
      const result3 = await this.$API.sku.getSpuImageList(row.id)
      if (result3.code === 200 || result3.code === 20000) {
        this.spuImageList=result3.data
      }
    }
  }
}
</script>

<style>

</style>
